using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter09
{
	/// <summary>
	/// Example13: The Center of Mass of Three Particles
	/// A system consists of three particles located as shown 
	/// in Figure 9.21a. Find the center of the system.
	/// r_{cm} = 0.75 i + 1.0 j
	/// </summary>
	public class Example13
	{
		public Example13()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass[] ms = new L.Mass[3];
			L.Position[] rs = new L.Position[3];
			ms[0] = new L.Mass();
			ms[0].kg = 1.0;
			ms[1] = new L.Mass();
			ms[1].kg = 1.0;
			ms[2] = new L.Mass();
			ms[2].kg = 2.0;
			rs[0] = new L.Position();
			rs[0].X = 1.0;
			rs[1] = new L.Position();
			rs[1].X = 2.0;
			rs[2] = new L.Position();
			rs[2].Y = 2.0; 

			L.CenterOfMass rcm = new L.CenterOfMass(ms, rs);
			result += Convert.ToString(rcm.X)+"\r\n";
			result += Convert.ToString(rcm.Y)+"\r\n";
			result += Convert.ToString(rcm.Z)+"\r\n";
		}
	}
}
